package com.probiz.estore.common.model.inventory;

import com.probiz.estore.common.model.inventory.base.InventoryTbl;

/**
 * Model class for Inventory. Add not database mapped fileds in this class.
 * 库存
 */
public class Inventory extends InventoryTbl {
	
	public static enum FilterHqlName{COUNT_LOW_STOCK,COUNT_LACK_STOCK};
	
	public final static Short INVENTORY_AVAILABLE = Short.valueOf((short)1);//正常
	public final static Short INVENTORY_LOW = Short.valueOf((short)0);  //低库存
	public final static Short INVENTORY_LACK = Short.valueOf((short)-1); //缺货

    public Integer getAvailableQuantity() {
    	if(null!= this.quantityOnHand){
    		//有限库存
    		return this.quantityOnHand - allocatedQuantity;
    	}else{
    		//无限库存
    		return null;
    	}
    }

    /**
     * Default Empty Constructor for class Inventory
     */
    public Inventory() {
        super();
    }

    /**
     * 定义实体的业务名取值
     *
     * @return 业务名
     */
    public String getInventoryName() {
        if (inventoryId == null)
            return "";
        else
            return this.inventoryId.toString();
    }

    /**
     * Default Key Fields Constructor for class Inventory
     * @param in_inventoryId 库存id
     */
    public Inventory(Integer in_inventoryId) {
        super(in_inventoryId);
	}
    

}
